//处理推荐作者逻辑
const db = require("../lib/db");
function autuorslist(){
    return new Promise((reslove,reject)=>{
  //处理逻辑的代码
  let sql = "select * from author"
  db.querySql(sql).then(data=>{
    if(data.length == 0){
      
    }else{
      //对数组进行一个乱序处理
      let arr = data.sort(()=>0.5 - Math.random())
      console.log(arr)
      let arr2 = []
      arr.map(ele=>{
        arr2.push({
        _id: Buffer.from(String(ele._id)).toString("base64"),
        userName : ele.userName ,
        headImg : ele.headImg,
        description : ele.description
        })
      })
      reslove(arr2)
    }
  })
    })
}


module.exports = autuorslist;